package com.sync.syncmasterdata.product.repository.oa;

import com.sync.syncmasterdata.product.entity.oa.ProductWorkflowDeleteEntity;
import com.sync.syncmasterdata.product.entity.oa.ProductWorkflowEntity;
import com.sync.syncmasterdata.product.entity.oa.ProductWorkflowUpdateEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface InventoryForUpdateWorkflowRepository extends JpaRepository<ProductWorkflowUpdateEntity,String> {

    /**
     * 产品更新时的表单
     */
    @Query(nativeQuery = true, value= "select main.requestid,dt2.id,dt2.crmid,dt2.cpid,dt2.chanpinmc,dt2.guochanjk,dt2.tongyongmc,dt2.cunhuobm,dt2.huohao,dt2.guigexh,dt2.zhujildw_o,dt2.pinpai,dt2.shengchanqy,dt2.shengchanqywb,dt2.yewulx,dt2.chanpinx,dt2.chanpinz,dt2.xiangmumc,dt2.xiangmumcwb,dt2.beizhu,dt2.shifouylqx,dt2.shifoucggh,item.selectname as kuweiwb from formtable_main_322 main inner join formtable_main_322_dt2 dt2 on dt2.mainid=main.id inner join workflow_SelectItem item on FIELDID=25750 and dt2.kuwei=selectvalue  where main.REQUESTID=:requestid")
    List<ProductWorkflowUpdateEntity> getProductWorkflowEntityForUpdate(@Param(value = "requestid") String requestid);

}
